
<div class="hl-product-list">
    <?php
    if(count($medias))
    {
    ?>
    	<?php if($sorting){ ?>
   	<div class="hl-post">
        <select id="order" class="hl-textbox hl-right" onchange="window.location = '?order='+this.value">
            <option value="new">Mới</option>
            <option value="gt">Giá tăng dần</option>
            <option value="gg">Giá giảm dần</option>
            <option value="az">Tên: A-Z</option>
        </select>
<script language="javascript">
$('#order').val('<?php echo $_GET["order"]?>');
</script>
        <div class="clearer">&nbsp;</div>
        
    </div>
    	<?php } ?>
        <?php if($paging){ ?>
    <?php echo $pager?>
    <div class="clearer">&nbsp;</div>
    <?php } ?>
    <div id="listpoduct">
        <?php foreach($medias as $key => $media) {?>
        <?php
            $class = "";
            if(($key +1)%3 == 0)
                $class = " endrow";
        ?>
        <div class="hl-left product<?php echo $class?>">
        	<div class="product-quichview" ref="<?php echo $media['mediaid']?>">
            	<img src="<?php echo HTTP_SERVER.DIR_IMAGE?>btn-quichview.png" />
            </div>
            <table>
                <tr>
                    <td>
                    	
                    	
                        <div class="product-title">
                        	<a href="<?php echo $media['link']?>"><?php echo $media['title']?></a>
                        </div>
                        <div class="clearer">&nbsp;</div>
                        <div class="product-image">
                        	<?php if($showicon){ ?>
                            <?php if(in_array("sanphamhot",$media['properties'])){ ?>
                            <div id="hl-icon-hot" class="hl-icon">
                                <img src="<?php echo HTTP_SERVER.DIR_IMAGE?>icon/ico-hot.png" />
                            </div>
                            <?php } ?>
                            <?php if(in_array("sanphamkhuyenmai",$media['properties'])){ ?>
                            <div id="hl-icon-sale" class="hl-icon">
                                <img src="<?php echo HTTP_SERVER.DIR_IMAGE?>icon/ico-sale.png" />
                            </div>
                            <?php } ?>
                            <?php if(in_array("sanphammoi",$media['properties'])){ ?>
                            <div id="hl-icon-new" class="hl-icon">
                                <img src="<?php echo HTTP_SERVER.DIR_IMAGE?>icon/ico-new.png" />
                            </div>
                            <?php } ?>
                            <?php if(in_array("hethang",$media['properties'])){ ?>
                            <div id="hl-icon-empty" class="hl-icon">
                                Hết hàng
                            </div>
                            <?php } ?>
                            <?php } ?>
                            <?php if($media['imagethumbnail'] !=""){ ?>
                            <table>
                            	<tr>
                                	<td>
                                    	<a class="islink" href="<?php echo $media['link']?>"><img src='<?php echo $media['imagethumbnail']?>' class='hl-center' /></a>
                                    </td>
                                </tr>
                            </table>
                            
                            <?php }?>
							
                        </div>
                        
                        
                    </td>
                </tr>
                <tr>
                    <td>
                        <div align="center" class="product-pricepromotion">
                        	<?php $cls = '';?>
                        	<?php if($media['pricepromotion']){ ?>
                            <?php $cls = 'product-price-no';?>
                        	<?php echo $this->string->numberFormate($media['pricepromotion'])?> <?php echo $this->document->setup['Currency']?>
                            <?php } ?>
                            </div>
                        <div align="center" class="product-price <?php echo $cls?>"><?php echo $this->string->numberFormate($media['price'])?> <?php echo $this->document->setup['Currency']?></div>
                        <div align="center">
                        	<a onclick="cart.add('<?php echo $media['mediaid']?>')"><img src="<?php echo HTTP_SERVER.DIR_IMAGE?>btn-add-cart.png" /></a>
                            <a href="<?php echo $media['link']?>"><img src="<?php echo HTTP_SERVER.DIR_IMAGE?>btn-detail.png" /></a>
                        </div>
                    </td>
                </tr>
            </table>
            <div class="clearer">&nbsp;</div>
            
            
            
        </div>
        <?php } ?>
        <div class="clearer">&nbsp;</div>
    </div>
        
    
    
    <div class="clearer">&nbsp;</div>
    	<?php if($paging){ ?>
    <div class="hl-post">
    	<?php echo $pager?>
    </div>
    	<?php } ?>
    <div class="clearer">&nbsp;</div>
    <?php
    }
    ?>
</div>
<script language="javascript">
$(document).ready(function(e) {
	$('.product').mouseover(function(e) {
       	$(this).children('.product-quichview').show();
    });
	$('.product').mouseout(function(e) {
        $(this).children('.product-quichview').hide();
    });
	$('.product-quichview').click(function(e) {
        //alert($(this).attr('ref'));
		//showPopup("#hl-popup", 600, 500, true );
		//$('#hl-popup-content').load(HTTP_SERVER+"?route=module/block/showProductQV&mediaid="+$(this).attr('ref'));
		$("#hl-popup").attr('title','Thông tin sản phẩm');
		$( "#hl-popup" ).dialog({
			autoOpen: false,
			show: "blind",
			hide: "explode",
			width: 600,
			height: 500,
			modal: true,
			buttons: {
				
				
				'Đóng': function() {
					$( this ).dialog( "close" );
				},
				
				
			}
		});
	
		
		$("#hl-popup-content").load(HTTP_SERVER+"?route=module/block/showProductQV&mediaid="+$(this).attr('ref'),function(){
			$("#hl-popup").dialog("open");	
		});
    });
});
</script>